package 创建型设计模式.工厂模式.简单工厂模式.demo;

/**
 * @Author lf
 * @Date 3/26/2024
 */
public class FactoryPatternDemo {
    public static void main(String[] args) {
        VehicleFactory vehicleFactory = new VehicleFactory();

        // 获取 Car 的对象，并调用它的 create 方法
        Vehicle vehicle1 = vehicleFactory.getVehicle("CAR");
        vehicle1.create();

        // 获取 Truck 的对象，并调用它的 create 方法
        Vehicle vehicle2 = vehicleFactory.getVehicle("TRUCK");
        vehicle2.create();
    }
}
